package cz.muni.pa036.hockeyStats;

/***********************************************************************
 * Module:  Team.java
 * Author:  Rojko
 * Purpose: Defines the Class Team
 ***********************************************************************/

/** @pdOid 9bc26d56-3cfb-4da0-9420-dd64e5c1659a */
public class Team {
   /** @pdOid e3681d2e-d17e-403e-b2ee-83ff26069b53 */
   public int idTeam;
   /** @pdOid 5e468ddc-2c74-41bf-b42e-697214e1a6c7 */
   public java.lang.String teamName;
   
   /** @pdRoleInfo migr=no name=Player assc=relationship8 coll=java.util.Collection impl=java.util.HashSet mult=0..* */
   public java.util.Collection<Player> player;
   
   
   /** @pdGenerated default getter */
   public java.util.Collection<Player> getPlayer() {
      if (player == null)
         player = new java.util.HashSet<Player>();
      return player;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorPlayer() {
      if (player == null)
         player = new java.util.HashSet<Player>();
      return player.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newPlayer */
   public void setPlayer(java.util.Collection<Player> newPlayer) {
      removeAllPlayer();
      for (java.util.Iterator iter = newPlayer.iterator(); iter.hasNext();)
         addPlayer((Player)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newPlayer */
   public void addPlayer(Player newPlayer) {
      if (newPlayer == null)
         return;
      if (this.player == null)
         this.player = new java.util.HashSet<Player>();
      if (!this.player.contains(newPlayer))
         this.player.add(newPlayer);
   }
   
   /** @pdGenerated default remove
     * @param oldPlayer */
   public void removePlayer(Player oldPlayer) {
      if (oldPlayer == null)
         return;
      if (this.player != null)
         if (this.player.contains(oldPlayer))
            this.player.remove(oldPlayer);
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllPlayer() {
      if (player != null)
         player.clear();
   }

}